

import java.math.BigDecimal;

public class GoldCard extends Card {

    @Override
    public void pay(BigDecimal amount) {
        BigDecimal conversion = new BigDecimal("0.8");
        BigDecimal payAmount = getPrice().subtract(amount.multiply(conversion));
        if (!getPrice().equals(payAmount)) {
            System.out.println("你已支付" + amount+ "\n" + "余额为" + payAmount);
        } else {
            System.out.println("余额不足。");
        }
    }

    @Override
    protected double getDiscountRate() {
        return 0.2; // 金卡20%折扣
    }
}
